#!/usr/bin/python
# -*-coding:UTF-8 -*-

# ========================
# @Time  : 2021/1/21
# @Author: Sunny
# ========================

cases = [
    ['case_id','case_title','url','data','excepted'],
    [1,'用例1','www.baidu.com','001','ok'],
    [4,'用例4','www.baidu.com','004','ok'],
    [2,'用例2','www.baidu.com','002','ok'],
    [3,'用例3','www.baidu.com','003','ok'],
    [5,'用例4','www.baidu.com','005','ok'],
]

#方法一：
def data_fun(case):

    key_list=[]
    value_list = []
    one_dict = []

    for j in case[1:-1]:
        for i in case[0]:
            key_list.append(i)
        for k in j:
            value_list.append(k)
        one_dict.append(dict(zip(key_list,value_list)))
    print(one_dict)

#方法二
two_dict = [dict(zip(cases[0],i))for i in cases[1:-1]]
print(two_dict)











